{% extends 'base.html' %}
{% load staticfiles %}

{% block title %}个人资料{% endblock %}
{% block nav_home_active %}active{% endblock %}


{% block content %}
    <div class="container">
        <div class="row">
            <div class="col-xs-10 col-xs-offset-1">
                <!--判断是否登录-->
                {% if user.is_authenticated %}
                    <!--已登录，显示个人信息-->
                    <h2>{{ user.username }}</h2>
                    <ul>
                        <li>头像：这是当前头像(待开发)
                            <a href="#">修改头像</a>
                        </li>
                        <li>昵称：{{ user.get_nickname }}  
                            <a href="{% url 'change_nickname' %}?from={{ request.get_full_path }}">修改昵称</a>
                        </li>
                        <li>邮箱：
                            {% if user.email %}
                                {{ user.email }}
                            {% else %}
                                未绑定  <a href="{% url 'bind_email' %}?from={{ request.get_full_path }}">绑定邮箱</a>
                            {% endif %}
                        </li>
                        <li>上次登录时间：{{ user.last_login|date:"Y-m-d H:i:s" }}</li>
                        <li><a href="{% url 'change_password' %}">修改密码</a></li>
                    </ul>
                {% else %}
                    <!--未登录，跳转回首页-->
                    <span>未登录，跳转到首页...</span>
                    <script type="text/javascript">
                        window.location.href = '/';
                    </script>
                {% endif %}
            </div>
        </div>
    </div>
{% endblock %}
